{% extends "base.html" %}
{% load blog_extras links_extras prefab_tags  %}
{% load blog_calendar %}
{% load cache i18n         %}
{% load blog_delicious     %}
{% block pagetitle %}{{block.super|safe}}{% endblock pagetitle %}
{% block page-container %}
<div class="container">
    <div class="span-24 header">
        <div class="span-2">
            <a class="sitelogo2" title="inici" href="{% setting 'BLOG_ROOT' %}"><img src="{{MEDIA_URL}}img/bg_head_top_logo.jpg" alt="logo"/></a>
        </div>
        <div class="span-14">
            <h1 class="pagetitle">
                <a href="{% setting 'BLOG_ROOT' %}">{% setting 'BLOG_NAME' %}</a>
            </h1>
            <h2 class="subtitle">{% setting 'BLOG_SUBTITLE' %}</h2>
        </div>
        <div class="span-8 last">
                {% block "blog_search" %}
                <div class="span-8">&nbsp;</div>
                <div class="span-8">
                <form action="{% BLOG_ROOT %}search/" method="post">
                    <input type="text" class="field" name="query" id="id_query" title="cercar ..." size="20"/>
                        {% if request.session.search_error %}<span title="les paraules de la cerca han de ser d'almanco 3 caracters">{{request.session.search_error}}</span>{% endif %}
                        <input type="submit" value="{% trans 'Au!' %}"  title="Cercar" class="button"/>
                </form>
                </div>
                {% endblock %}
        </div>
        <div class="span-24 last nav2">
            <ul id="nav" class="dropdown dropdown-horizontal"><li><a href="/">{% trans "Index" %}</a>
                    <ul>
                        {% if not user.is_authenticated %}
                        <li><a href="/admin/">{% trans "Login" %}</a></li>
                        {% else %}
                        <li><a href="/admin/blog/entry/add/">{% trans "Nou post" %}</a></li>
                        <li><a href="/admin/blog/entry/">{% trans "Posts" %}</a></li>
                        <li><a href="/admin/logout/">{% trans "Logout" %} {{user.username}}</a></li>
                        {% endif %}
                    </ul>
                </li>
                {% cache 500  blog_roll %}
                {% get_blogroll as blogs %}
                {% if blogs %}
                <li><span class="dir">{% trans "De visita obligada" %}</span>
                    <ul>

                        {% for blog in blogs %}
                        <li><a href="{{blog.url}}" title="{{blog.description}}">{{blog.name}}</a></li>
                        {% endfor%}
                    </ul>
                </li>
                {% endif %}
                {% endcache %}
                <li><span class="dir">{% trans "Projectes" %}</span>
                    <ul>
                        <li><a href="http://code.google.com/p/trespams/" title="codi d'aquest blog">Codi de trespams</a></li>
                        <li><a href="http://code.google.com/p/appfusedjango/" title="django start applications">Django samples</a></li>
                        <li><a href="http://code.google.com/p/trespams-vim/" title="Configuració per vim">Trespams VIM</a></li>
                    </ul>
                </li>
                {% cache 86400 archive_list %}
                {% get_yearly_archive as archive_list %}
                {% if archive_list %}
                {% regroup archive_list by year as historial_list %}
                <li><span class="dir">{% trans "Historial" %}</span>
                    <ul>
                    {% for year in historial_list %}
                            <li><span class="dir">{{year.grouper }}</span>
                                <ul>
                                {% for d in year.list %}
                                    <li><a href='{% setting "BLOG_ROOT" %}{{ year.grouper }}/{{ d|date:"m" }}/' class='menu_content'>{{ d|date:"M Y" }}</a></li>
                                {% endfor %}
                                </ul>
                            </li>
                    {% endfor %}
                    </ul>
                </li>
                {% endif %}
                {% endcache %}
                {% cache 3600 articles_recents %}
                <li><span class="dir">{% trans "Articles recents" %}</span>
                {% include "blog/includes/recent_posts.html" %}
                <li><span class="dir">{% trans "Experiments" %}</span>
                <ul>
                    <li><a href="/table/">{%trans "Continguts" %}</a></li>
                </ul></li>
                <li><span class="dir">{% trans "About" %}</span>
                <ul>
                    <!-- flatpages -->
                    <li><a href="/about/">{%trans "Sobre mi" %}</a></li><!-- about me -->
                    <li><a href="/about-this/">{%trans "Sobre aquest blog" %}</a></li><!-- about this blog -->
                </ul></li>
                {% endcache %}
                <li>
             </ul>
            </div>
        </div> <!-- nav2 -->
    <div class="span-24 main">
        <div class="span-5 append-1 menu_lateral">

            {% block recent %}
			<div class="span-5 append-1 last" id="calendar_container">
				{% if today %}
				<p class="calendar_month">{{ today|date:"F Y" }}</p>
				{% post_calendar today %}
				{% else %}
				    {% if month %}
				        <p  class="calendar_month">{{ month|date:"F Y" }}</p>
				        {% post_calendar month %}
					{% else %}
					   {% if day %}
                            <p  class="calendar_month">{{ day|date:"F Y" }}</p>
                            {% post_calendar day %}
                       {% else %}
                            {% post_calendar today %}
                       {% endif %}
					{% endif %}
				{% endif %}
			</div>
            {% endblock recent %}
            {% get_links as links %}
            {% if links %}
            <div class="span-5 append-1 last" id="links_container">
                <g:plusone size="small"></g:plusone>
                <h2>{% trans "Links destacats" %}</h2>
                <h3>Llocs i articles</h3>
                <dl>
                    {% for link in links %}
                    <dd><a href="{{link.url}}" class='menu_content'>{{link.name}}</a></dd>
                    {% endfor %}
               </dl>
            </div>
            {% endif %}
            <div class="span-5 append-1 last" id="links_delicious">
                {% get_delicious_links as delicious_links %}
                <h3>{% trans "Del.icio.us" %}</h3>
                <dl>
                    {% for link in delicious_links %}
                    <dd><a rel="external nofollow" href="{{link.link}}" class='menu_content' title="{{link.title}}">{{link.title|to_limit:25}}</a></dd>
                    {% endfor %}
               </dl>
            </div>


            <div class="span-5 append-1 last" id="web2_container">
            <h2>{% trans "Web 2.0" %}</h2>
            <h3>{% trans "Tags" %}</h3>
            <dl>
                {% block "taglist" %}{% endblock %}
            </dl>

            <h3>{% trans "Feeds" %}</h3>
            <dl>
                <dd>
                    <a href="{% setting 'BLOG_ROOT' %}feeds/posts/" title="{% trans 'Darrers articles' %}">
                        <img src='{% setting "MEDIA_URL" %}images/rss-button.gif' border='0' height='11' alt='rss'/>
                        {% trans "Articles" %}
                    </a>
                </dd>
                <dd>
                    <a href="{% setting 'BLOG_ROOT' %}feeds/comments/" title="{% trans 'Darrers comentaris' %}">
                        <img src='{% setting "MEDIA_URL" %}images/rss-button.gif' border='0' height='11' alt='rss'/>
                        {% trans "Commentaris" %}
                    </a>
                </dd>
                <dd>&nbsp;</dd>
            </dl>
            </div>
            {% get_recent_comments 7 as comments %}
            {% if links %}
            <div class="span-5 append-1 last" id="links_container">
                <h3>{% trans "Darrers comentaris" %}</h3>
                <dl>
                    {% for comment in comments %}
                    <dt><a href="{{comment.get_absolute_url}}">{{comment.person_name}}</a></dt>
                    <dd>{% trans "al post" %} {{comment.link_to_post|safe}}</dd>
                    {% endfor %}
               </dl>
            </div>
            {% endif %}

        <div id="twitter_div">
        <h3 class="sidebar-title">{% trans "Twitts" %}</h3>
        <ul id="twitter_update_list"></ul>
        <br/>
        <a href="http://twitter.com/aaloy" id="twitter-link" style="display:block;text-align:center;">{% trans "Follow me on Twitter" %}</a>
        </div>

        </div> <!-- main navigation-->
        <div class="main-content span-17 last">
            {% block "contentbody" %}
            {% endblock "contentbody" %}
        </div> <!--main content-->
    </div><!-- main -->

	{% block footer %}
    <div class="peu span-24 last">
        <p class="span-24">Copyright © 2007 Trespams.com | <a title="sota llicència creative commons" href="http://creativecommons.org/licenses/by/2.5/deed.ca">Llicència CC Attribution</a> |&nbsp;Hostejat a <a href="http://apsl.net" title="apsl"> APSL</a> </p>
    </div><!--footer-->
    {% endblock footer %}
</div>
{% endblock page-container %}
{% block syntaxhighlighter %}
<script type="text/javascript" language="javascript">
  $(document).ready(function() {
    $('#id_query').labelify();
  });
</script>
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/{% TWITTER_USER %}.json?callback=twitterCallback2&amp;count=5"></script>
{% endblock %}
